﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_List_album : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        cldDate.SelectedDate = DateTime.Today;
        if (Convert.ToString(Session["Dangnhap"]) == "")
            Response.Redirect("~/Admin/Login.aspx");

        else
            Response.Write("Xin chào " + Convert.ToString(Session["Dangnhap"]));
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        lblEdit.Visible = true;
        Button4.Visible = true;
        txtAlbum.Visible = true;
        txtDescription.Visible = true;
        cldDate.Visible = true;
        ddlID.Visible = true;
        Label3.Visible = true;
        Label4.Visible = true;
        Label5.Visible = true;
        Label6.Visible = true;
       // Label7.Visible = true;
        //txtID.Visible = true;
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        SqlDataSource1.Update();
        
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtID.Text = HttpUtility.HtmlDecode(GridView1.Rows[GridView1.SelectedIndex].Cells[1].Text); 
        txtAlbum.Text = HttpUtility.HtmlDecode(GridView1.Rows[GridView1.SelectedIndex].Cells[2].Text);
        txtDescription.Text = HttpUtility.HtmlDecode(GridView1.Rows[GridView1.SelectedIndex].Cells[3].Text);
        ddlID.SelectedValue = HttpUtility.HtmlDecode(GridView1.Rows[GridView1.SelectedIndex].Cells[5].Text); 

    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        SqlDataSource1.Delete();
        Response.Redirect("~/Admin/List_album.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Admin/Add_album.aspx");
    }
}
